<?php
header('Content-Type:application/json; charset=utf8');
class Register_type{
	public $status='error';//状态信息 success 是 处理 成功 error 是 处理失败
	public $type='register';//数据类型
}
$reqData=new Register_type();
//print_r($_POST);
if(@$_POST['username']&&@$_POST['password']&&@$_POST['email']){
	$username=$_POST['username'];
	$password=$_POST['password'];
	$email=$_POST['email'];
	//导入 配置信息
include("config.php");
//导入 登陆 信息 结构 

$dbconf=new DBConfig();

$conn= new mysqli($dbconf->servername,$dbconf->username,$dbconf->password,$dbconf->dbname);
if ($conn->connect_error) {
	   // die("mysql连接失败: " . $conn->connect_error);
	   $reqData->status='error';
	   $reqData->type='mysql';
}
$sql="INSERT INTO `user` ( `username`, `password`, `emain`) VALUES ( '$username', md5('$password'), '$email');";
//echo $sql;
if ($conn->query($sql) === TRUE) {
    $reqData->status='success';
} else {
	//如果 依旧 是被  则 只能返回错误
   $reqData->status='error';
}

//echo $sql;
}
echo json_encode($reqData);
?>
